<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Test</title>
		 <script src="https://www.promisejs.org/polyfills/promise-6.1.0.js"></script>
  		<script src="http://gosspublic.alicdn.com/aliyun-oss-sdk.min.js"></script>
	</head>
	<body>
		<input id="file" type="file" onchange="upload();"/>
	</body>
	<script type="text/javascript">
		function upload(){
			
			var files = document.getElementById('file').files;
			
			var formData = new FormData();
			formData.set("file",files[0]);
			
			var xhr = new XMLHttpRequest();
			xhr.open('POST','${ctxPath}/oss/upload',true);
			xhr.setRequestHeader('x-requested-with','XMLHttpRequest');
			xhr.send(formData);
			xhr.onreadystatechange = function(){
				if(xhr.readyState == 4 && xhr.status == 200){
					var response = JSON.parse(xhr.responseText);
					console.log(response);
				}
			}
		}
	</script>
</html>